
package com.xiaoye.qbdatahandle.domian.wiki;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xiaoye.qbdatahandle.controller.ContentInfoExcelConverter;
import com.xiaoye.qbdatahandle.converter.EntityToStringConverter;
import com.xiaoye.qbdatahandle.converter.ListRefToJsonConverter;
import com.xiaoye.qbdatahandle.converter.ListToJsonConverter;
import com.xiaoye.qbdatahandle.entity.ImageEntity;
import com.xiaoye.qbdatahandle.handle.ListToRefTypeHandler;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

@Data
@Document(collection = "wiki")
public class Wiki {
    @ExcelProperty("id")
    @Id
    private String id;
    @ExcelProperty(value = "专辑", converter = ListToJsonConverter.class)
    @Field(name = "albums")
    private List<String> albums;
    @ExcelProperty("官方链接")
    @Field(name = "canonical_link")
    private String canonicalLink;
    @ExcelProperty(value = "类别", converter = ListToJsonConverter.class)
    @Field(name = "categories", targetType = FieldType.ARRAY)
    private List<String> categories;
    @ExcelProperty(value = "内容", converter = ContentInfoExcelConverter.class)
    @Field(name = "content_info")
    private ContentInfo contentInfo;

    @ExcelProperty("关键词")
    @Field(name = "keywords")
    private String keywords;
    @ExcelProperty("语言")
    @Field(name = "lang")
    private String lang;
    @ExcelProperty("发布时间")
    @Field(name = "publish_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String publishTime;
    @ExcelProperty("qid")
    @Field(name = "qid")
    private String qid;
    @ExcelProperty(value = "引用", converter = ListRefToJsonConverter.class)
    @Field(name = "reference", targetType = FieldType.ARRAY)
    private List<Reference> references;
    @ExcelProperty("概述")
    @Field(name = "short_desc")
    private String shortDesc;
    @ExcelProperty("来源")
    @Field(name = "source")
    private String source;
    @ExcelProperty("缩略图链接")
    @Field(name = "thumbnail_url")
    private String thumbnailUrl;
    @ExcelProperty("标题")
    @Field(name = "title")
    private String title;
    @ExcelProperty("类型")
    @Field(name = "type")
    private String type;
    @ExcelProperty("网址")
    @Field(name = "url")
    private String url;
    /**
     * 图片
     */
    @ExcelIgnore
    @Field(name = "images", targetType = FieldType.ARRAY)
    private List<ImageEntity> images;
    /**
     * 是否清洗过
     */
    @Field(name = "is_handle", targetType = FieldType.BOOLEAN)
    private Boolean isHandle;
    /**
     * 是否分析过
     */
    @Field(name = "is_analysis", targetType = FieldType.BOOLEAN)
    private Boolean isAnalysis;
    @ExcelProperty("更新时间")
    @Field(name = "update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String updateTime;
    @ExcelProperty("创建时间")
    @Field(value = "create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String createTime;
    @ExcelProperty("描述")
    @Field(name = "desc")
    private String desc;
    @ExcelProperty("描述信息")
    @Field(name = "description")
    private String description;

    /**
     * 任务id
     */
    @ExcelProperty("任务id")
    @Field(name = "_tid", targetType = FieldType.OBJECT_ID)
    private String tid;


    @ExcelProperty("正文图片")
    private String contentImages;

}
